var { getLoginedUser, setTitle, fnLoading, fnHideLoading, fnSuccess, fnFail } = require('../../utils/index')
import { domainStatic } from '../../utils/env.js';
import { checkLoginAsyc } from '../../utils/util.js';
import _ from '../../utils/underscore.js';
import { get, checkCoupon, fnChoose, lsGetStr, fnUpload, post } from '../../utils/request.js';
var WxParse = require('../../pages/wxParse/wxParse.js');


Component({
  properties: {
    typeId: {
      type: String,
      value: '',
      
    }
  },
  data: {
    typeId:''
  },
  lifetimes: {
    attached: function () {
    },
    moved: function () {
    },
    detached: function () {
    },
  },
  attached() {
  }, // 此处attached的声明会被lifetimes字段中的声明覆盖
  ready: function () {
    this.setData({
      typeId: this.properties.typeId || ''
    })
  },
  methods: {},

  pageLifetimes: {
    // 组件所在页面的生命周期函数
    show: function () {
      let that = this;
        get({
          path: "/offer/get?id="+that.data.typeId
        })
          .then(function (res) {
            res.offer.detail = res.offer.detail.indexOf('%3D') > -1 ? unescape(res.offer.detail) : res.offer.detail;
            fnHideLoading();
            WxParse.wxParse('article', 'html', res.offer.detail, that, 0);
          })
      
    },
  },
})